﻿<Popover Style="{width: 500}" OnVisibleChange="OnHoverVisibleChange" Visible="_hoverVisible" Title="Hover title" Trigger="@(new AntDesign.TriggerType[] { AntDesign.TriggerType.Hover})">
    <ContentTemplate>
        <div> This is hover content.</div>
    </ContentTemplate>
    <ChildContent>
        <Popover OnVisibleChange="OnClickVisibleChange" Visible="_clickVisible" Content="_clickContent" Title="Click title" Trigger="@(new AntDesign.TriggerType[] { AntDesign.TriggerType.Click})">
            <ContentTemplate>
                <div>
                    <div>This is click content.</div>
                    <a @onclick="_=>Close()">Close</a>
                </div>
            </ContentTemplate>
            <ChildContent>
                <Button>Hover and click / 悬停并单击</Button>
            </ChildContent>

        </Popover>
    </ChildContent>
</Popover>

@code{

    private bool _hoverVisible = false;
    private bool _clickVisible = false;

    private void OnHoverVisibleChange(bool visible)
    {
        _hoverVisible = visible;
    }

    private void OnClickVisibleChange(bool visible)
    {
        _clickVisible = visible;
        _hoverVisible = false;
    }

    private void Close()
    {
        _hoverVisible = false;
        _clickVisible = false;
    }
}
